const {Menu , openDevTools} = require('electron')
var template = [
    {
        label:'文件',
        submenu:[
            {label:'保存进度'},
            {label:'打开存档'},
            {label:'退出',accelerator:('alt+f4'),role: 'close'}
        ]
    },
    {
        label:'查看',
        submenu:[
            {
                label:'切换开发工具',
                accelerator: (function () {
                    if (process.platform === 'darwin') {
                      return 'Alt+Command+I'
                    } else {
                      return 'Ctrl+Shift+I'
                    }
                  })(),
                  click: function (item, focusedWindow) {
                    if (focusedWindow) {
                      focusedWindow.toggleDevTools()
                    }
                  }
            },
            {label:'切换全屏状态',
            accelerator: (function () {
                if (process.platform === 'darwin') {
                  return 'Ctrl+Command+F'
                } else {
                  return 'F11'
                }
              })(),
              click: function (item, focusedWindow) {
                if (focusedWindow) {
                  focusedWindow.setFullScreen(!focusedWindow.isFullScreen())
                }
              }
        }
        ]
    }
]
var m = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(m)